#ifndef GAMEENGINE_H
#define GAMEENGINE_H

#include "includes.h"
#include "CharacterController.h"
#include "PhysicsEngine.h"
#include "Collision.h"
#include "GameElementFactory.h"

#define GE_MAX_ELEMENTS 1000
#define GE_BODY_OFFSET 0.05
#define ACTIVATE_EVENT_EPSILON 1

class GameEngine
{
    QuickArray<GameElement*,GE_MAX_ELEMENTS> elements;
    PhysicsEngine physEng;

    GameEngine();
    void update();
    void compileElements();
    void invokeCollisionEvent();
    void invokeUpdateEvent();

public:
    GameElementFactory factory;
    CharacterController charCon;
    static GameEngine* getInstance();
    void editorRender();
    void render();
    void renderOverlay();
    void invokeActivateEvent();
    void initSession();
    void resetSession();
    void resetGame();
    bool checkEndGameCondition();
};

#endif // GAMEENGINE_H
